package admin

import (
	"beergo/app/hr/conf"
	"beergo/lib/tool"
	"github.com/beego/beego/v2/server/web"
)

func init() {
	web.Router(conf.UrlPrefix + "/ProfileMain/my", 		&ProfileMainAdminController{}, "*:MyAction")
}

func (this *ProfileMainAdminController) MyAction() {
	user:=this.GetUser()
	find:=this.Repository.FindOneBy(tool.M{"createBy":user.Id},[]string{"-id"})
	if find.Id == 0 {
		find = *this.Model.New()
		find.CreateBy = user.Id
		find.Phone = user.Phone
		_,e:=find.Save()
		this.AnaliseErrors(e)
	}
	this.ReturnSuccess("我的简历",find.Scan("",2,""))
}
